import $http from '@/assets/js/http'

//获取用户协议
export function getUserAgreement(lang){
    return $http.get('/api/config/userXieyi',{
        params:{
            lang:lang,
        }
    })
}

//发表意见反馈
export function postSuggestion(userId,content,lang){
    return $http.post('/api/feedback/add',{
        userId:userId,
        content:content,
        lang:lang
    });
}

//获取我的--收货地址列表
export function getMyAddress(userId){
    return $http.get('/api/address/list',{
        params:{
            userId:userId,
        }
    })
}

//设置默认收货地址
export function postDefaultAddress(userId,addressId,lang){
    return $http.post('/api/address/default',{
        userId:userId,
        addressId:addressId,
        lang:lang
    });
}


//删除地址                  
export function postDelAddress(id,lang){
    return $http.post('/api/address/delete',{
        id:id,
        lang:lang
    });
}
//新增用户地址
export function postAddAddress(param) {
    return $http.post('/api/address/add', {
        userId:param.userId,
        name:param.name,
        mobile:param.tel,
        province:param.province,
        city:param.city,
        district:param.county,
        address:param.addressDetail,
        zipCode:param.postalCode,
        isDefault:param.isDefault,
        lang:param.lang
    });
}

//编辑用户地址
export function postEditAddress(param) {
    return $http.post('/api/address/modify', {
        id:param.id,
        userId:param.userId,
        name:param.name,
        mobile:param.tel,
        province:param.province,
        city:param.city,
        district:param.county,
        address:param.addressDetail,
        zipCode:param.postalCode,
        isDefault:param.isDefault,
        lang:param.lang
    });
}


//查询用户账号信息
export function getAccountInfo(userId){
    return $http.get('/api/account/info',{
        params:{
            userId:userId,
        }
    });
}

//获取用户交易记录
export function getTradeList(userId,pageIndex,pageSize){
    return $http.get('/api/account/trade/list',{
        params:{
            userId:userId,
            pageIndex:pageIndex,
            pageSize:pageSize,
        }
    });
}

//提现
export function postWithdraw(userId,accountBankId,money,lang){
    return $http.post('/api/account/withdrawal/apply',{
            userId:userId,
            accountBankId:accountBankId,
            money:money,
            lang:lang
    });
}

